package com.ag.bean;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * TbPlan entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "TB_PLAN", schema = "dbo", catalog = "AGDB")
public class TbPlan implements java.io.Serializable {

	// Fields

	private String PId;
	private TbPlanGrade tbPlanGrade;
	private TbPlanScope tbPlanScope;
	private TbPlanRegion tbPlanRegion;
	private TbPlanStatus tbPlanStatus;
	private TbEventType tbEventType;
	private TbPlanType tbPlanType;
	private String PName;
	private String PSummary;
	private String PUnit;
	private Date PTime;
	private String PContractor;
	private String PVersion;
	private String POpinion;
	private String a;
	private String b;
	private String c;
	private String d;

	private Set<TbPlanAnnex> tbPlanAnnexes = new HashSet<TbPlanAnnex>(0);
	private Set<TbEventPlan> tbEventPlans = new HashSet<TbEventPlan>(0);
	private Set<TbPlanKeyword> tbPlanKeywords = new HashSet<TbPlanKeyword>(0);
	private Set<TbPlanStep> tbPlanSteps = new HashSet<TbPlanStep>(0);
	private Set<TbLog> tbLogs = new HashSet<TbLog>(0);
	private Set<TbEventGrade> tbEventGrades = new HashSet<TbEventGrade>(0);
	private Set<TbLogPlanStep> tbLogPlanSteps = new HashSet<TbLogPlanStep>(0);

	// Constructors

	/** default constructor */
	public TbPlan() {
	}

	/** minimal constructor */
	public TbPlan(String PId, String PName, String PSummary, String PUnit,
			Date PTime, String PContractor, String PVersion) {
		this.PId = PId;
		this.PName = PName;
		this.PSummary = PSummary;
		this.PUnit = PUnit;
		this.PTime = PTime;
		this.PContractor = PContractor;
		this.PVersion = PVersion;
	}

	/** full constructor */
	public TbPlan(String PId, TbPlanGrade tbPlanGrade, TbPlanScope tbPlanScope,
			TbPlanRegion tbPlanRegion, TbPlanStatus tbPlanStatus,
			TbEventType tbEventType, TbPlanType tbPlanType, String PName,
			String PSummary, String PUnit, Date PTime, String PContractor,
			String PVersion, String POpinion, String a, String b, String c,
			Set<TbPlanAnnex> tbPlanAnnexes, Set<TbEventPlan> tbEventPlans,
			Set<TbPlanKeyword> tbPlanKeywords, Set<TbPlanStep> tbPlanSteps,
			Set<TbLog> tbLogs, Set<TbEventGrade> tbEventGrades,
			Set<TbLogPlanStep> tbLogPlanSteps) {
		this.PId = PId;
		this.tbPlanGrade = tbPlanGrade;
		this.tbPlanScope = tbPlanScope;
		this.tbPlanRegion = tbPlanRegion;
		this.tbPlanStatus = tbPlanStatus;
		this.tbEventType = tbEventType;
		this.tbPlanType = tbPlanType;
		this.PName = PName;
		this.PSummary = PSummary;
		this.PUnit = PUnit;
		this.PTime = PTime;
		this.PContractor = PContractor;
		this.PVersion = PVersion;
		this.POpinion = POpinion;
		this.a = a;
		this.b = b;
		this.c = c;
		this.tbPlanAnnexes = tbPlanAnnexes;
		this.tbEventPlans = tbEventPlans;
		this.tbPlanKeywords = tbPlanKeywords;
		this.tbPlanSteps = tbPlanSteps;
		this.tbLogs = tbLogs;
		this.tbEventGrades = tbEventGrades;
		this.tbLogPlanSteps = tbLogPlanSteps;
	}

	// Property accessors
	@Id
	@Column(name = "P_ID", unique = true, nullable = false, length = 10)
	public String getPId() {
		return this.PId;
	}

	public void setPId(String PId) {
		this.PId = PId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PG_ID")
	public TbPlanGrade getTbPlanGrade() {
		return this.tbPlanGrade;
	}

	public void setTbPlanGrade(TbPlanGrade tbPlanGrade) {
		this.tbPlanGrade = tbPlanGrade;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TB__PS_ID")
	public TbPlanScope getTbPlanScope() {
		return this.tbPlanScope;
	}

	public void setTbPlanScope(TbPlanScope tbPlanScope) {
		this.tbPlanScope = tbPlanScope;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PS_ID")
	public TbPlanRegion getTbPlanRegion() {
		return this.tbPlanRegion;
	}

	public void setTbPlanRegion(TbPlanRegion tbPlanRegion) {
		this.tbPlanRegion = tbPlanRegion;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PST_ID")
	public TbPlanStatus getTbPlanStatus() {
		return this.tbPlanStatus;
	}

	public void setTbPlanStatus(TbPlanStatus tbPlanStatus) {
		this.tbPlanStatus = tbPlanStatus;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ET_ID")
	public TbEventType getTbEventType() {
		return this.tbEventType;
	}

	public void setTbEventType(TbEventType tbEventType) {
		this.tbEventType = tbEventType;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PT_ID")
	public TbPlanType getTbPlanType() {
		return this.tbPlanType;
	}

	public void setTbPlanType(TbPlanType tbPlanType) {
		this.tbPlanType = tbPlanType;
	}

	@Column(name = "P_NAME", nullable = false, length = 100)
	public String getPName() {
		return this.PName;
	}

	public void setPName(String PName) {
		this.PName = PName;
	}

	@Column(name = "P_SUMMARY", nullable = false, length = 50)
	public String getPSummary() {
		return this.PSummary;
	}

	public void setPSummary(String PSummary) {
		this.PSummary = PSummary;
	}

	@Column(name = "P_UNIT", nullable = false, length = 20)
	public String getPUnit() {
		return this.PUnit;
	}

	public void setPUnit(String PUnit) {
		this.PUnit = PUnit;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "P_TIME", nullable = false, length = 23)
	public Date getPTime() {
		return this.PTime;
	}

	public void setPTime(Date PTime) {
		this.PTime = PTime;
	}

	@Column(name = "P_CONTRACTOR", nullable = false, length = 20)
	public String getPContractor() {
		return this.PContractor;
	}

	public void setPContractor(String PContractor) {
		this.PContractor = PContractor;
	}

	@Column(name = "P_VERSION", nullable = false, length = 2)
	public String getPVersion() {
		return this.PVersion;
	}

	public void setPVersion(String PVersion) {
		this.PVersion = PVersion;
	}

	@Column(name = "P_OPINION", length = 50)
	public String getPOpinion() {
		return this.POpinion;
	}

	public void setPOpinion(String POpinion) {
		this.POpinion = POpinion;
	}

	@Column(name = "A", length = 50)
	public String getA() {
		return this.a;
	}

	public void setA(String a) {
		this.a = a;
	}

	@Column(name = "B", length = 1000)
	public String getB() {
		return this.b;
	}

	public void setB(String b) {
		this.b = b;
	}

	@Column(name = "C", length = 1000)
	public String getC() {
		return this.c;
	}

	public void setC(String c) {
		this.c = c;
	}
	
	@Column(name = "D", length = 1000)
	public String getD() {
		return d;
	}

	public void setD(String d) {
		this.d = d;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbPlan")
	public Set<TbPlanAnnex> getTbPlanAnnexes() {
		return this.tbPlanAnnexes;
	}

	public void setTbPlanAnnexes(Set<TbPlanAnnex> tbPlanAnnexes) {
		this.tbPlanAnnexes = tbPlanAnnexes;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbPlan")
	public Set<TbEventPlan> getTbEventPlans() {
		return this.tbEventPlans;
	}

	public void setTbEventPlans(Set<TbEventPlan> tbEventPlans) {
		this.tbEventPlans = tbEventPlans;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbPlan")
	public Set<TbPlanKeyword> getTbPlanKeywords() {
		return this.tbPlanKeywords;
	}

	public void setTbPlanKeywords(Set<TbPlanKeyword> tbPlanKeywords) {
		this.tbPlanKeywords = tbPlanKeywords;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbPlan")
	@javax.persistence.OrderBy("psId")
	public Set<TbPlanStep> getTbPlanSteps() {
		return this.tbPlanSteps;
	}

	public void setTbPlanSteps(Set<TbPlanStep> tbPlanSteps) {
		this.tbPlanSteps = tbPlanSteps;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbPlan")
	public Set<TbLog> getTbLogs() {
		return this.tbLogs;
	}

	public void setTbLogs(Set<TbLog> tbLogs) {
		this.tbLogs = tbLogs;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbPlan")
	public Set<TbEventGrade> getTbEventGrades() {
		return this.tbEventGrades;
	}

	public void setTbEventGrades(Set<TbEventGrade> tbEventGrades) {
		this.tbEventGrades = tbEventGrades;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbPlan")
	public Set<TbLogPlanStep> getTbLogPlanSteps() {
		return this.tbLogPlanSteps;
	}

	public void setTbLogPlanSteps(Set<TbLogPlanStep> tbLogPlanSteps) {
		this.tbLogPlanSteps = tbLogPlanSteps;
	}

}